package com.zx.cloud.controller.client;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.zx.cloud.Shift;
import com.zx.cloud.common.auth0.jwt.Token;
import com.zx.cloud.controller.StatusCode;
import com.zx.cloud.domain.User;
import com.zx.cloud.model.request.ManagerLoginRequest;
import com.zx.cloud.model.response.ObjectDataResponse;

@Component
public class LoginClientFallBack implements LoginClient {

	private static final Logger LOGGER = LoggerFactory.getLogger(LoginClientFallBack.class);
	
	private void didNotGetResponse() {
        LOGGER.error("service '{}' has become unreachable", LoginClient.SERVICE_ID);
    }

	@Override
	public ObjectDataResponse<Token> login(ManagerLoginRequest managerLoginRequest) {
		didNotGetResponse();
        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

	@Override
	public ObjectDataResponse<User> loginFind(User user) {
		didNotGetResponse();
        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

	@Override
	public ObjectDataResponse<Integer> updatePassWord(User user) {
		didNotGetResponse();
        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

	@Override
	public ObjectDataResponse<Map<String, Object>> statisticalInformation() {
		didNotGetResponse();
        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

}
